module.exports = {
  /**
   * 获取答卷
  */
  async getAnswers(req) {
    const { paperId } = req.query;
    const count = await req.answersModel.getAnswersCount(paperId);
    const result = await req.answersModel.getAnswers(paperId, req.query);

    return {
      count,
      result,
    };
  },
  /**
   * 添加
  */
  async addAnswer(req) {
    const result = await req.answersModel.addAnswers(req.payload);
    return result;
  },

  /**
   * 根据ID获取单个答卷信息
   */
  async getAnswerById(req) {
    const result = await req.answersModel.getAnswerById(req.params.id);
    return result;
  },

  /**
   * 根据ID删除答卷
   */
  async deleteAnswerById(req) {
    await req.answersModel.deleteAnswerById(req.params.id);
    return {};
  },

};
